/*==============================================================================
FILE NAME: Create_NOE_Cat.do
INPUT: enforcement.dta
OUTPUT: NOE_cat.dta
CREATED: 18 July 2025
==============================================================================*/

/* Set directory if working independently through code
if c(username)=="" { //insert username
	global rootdir "" // insert root path
	global processed_data "$rootdir/processed_data"  // Define global paths for replication package
} 
*/

use "$processed_data/enforcement.dta", clear
keep ViolationTrackNo ViolationCateogry 
duplicates drop
rename ViolationTrackNo VN
isid VN 
egen NOE_cat=group(ViolationCateogry)
label define NOE_cat 1 "Category A" 2 "Category B" 3 "Category C"
label values NOE_cat NOE_cat
drop ViolationCateogry
sort VN
save "$processed_data/NOE_cat.dta", replace
